<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>商城首页</title>
    <%@include file="../common/header.jsp" %>
    <jsp:include page="../../common/layer.jsp"></jsp:include>
    <jsp:include page="../../common/webupload.jsp"></jsp:include>
    <script type="text/javascript">
      $(function(){
    	  $("#btnSubmit").click(function(){
    		   var username=$("#username").val();
    		   var password=$("#password").val();
    		   var txtPassword1=$("#txtPassword1").val();
    		   var phone=$("#phone").val();
    		   var email=$("#email").val();
    		   var txtCode=$("#txtCode").val();
    		   if(username==""){
    			   alert("请输入用户名！");
    			   return false;
    		   }else if(password==""){
    			   alert("请输入密码");
    			   return false;
    		   }else if(txtPassword1!=password){
    			   alert("密码不一致！");
    			   return false;
    		   }else if(phone==""){
    			   alert("请输入手机号码");
    			   return false;
    		   }else if(email==""){
    			   alert("请输入电子邮箱！");
    			   return false;
    		   }else if(txtCode==""){
    			   alert("请输入验证码！");
    			   return false;
    		   }
    		   
    		   var url="${pathUrl}/home/index/submitRegister";
    		   $.post(url,$("#regform").serializeArray(),function(resultObj){
    			    if(resultObj.status==1){
    			    	window.location.href="${pathUrl}/home/index/index";
    			    }else{
    			    	alert(resultObj.msg);
    			    }
    		   });
    		  
    	  });
    	  
    	    createWebUploader("#userImgDiv",function(result){
    	    	$("#userImg").val(result.data.url);
    	    	$("#tupian").empty();
    	    	$("#tupian").html("<a href='${pathUrl}"+result.data.url+"' target='_black'><img src='${pathUrl}"+result.data.url+"' style='width: 40px;height:40px;'/></a>");
    	    });
      });
      
      
    </script>
</head>
<body>

<%@include file="../common/top.jsp" %>
<div class="section">
    <div class="nav-tit">
        <a class="selected" href="${pathUrl }/home/index/register">会员注册</a>
        <i>|</i>
        <a href="${pathUrl }/home/index/login">账户登录</a>
    </div>

    <form id="regform"  onsubmit="return false;" name="regform"  method="post" >
        <div class="form-box full">
            <dl class="form-group">
                <dt>用 户 名：</dt>
                <dd>
                    <input id="username" name="username" type="text" class="input" placeholder="输入登录用户名" >
                    <span class="Validform_checktip">请输入登录的用户名</span>
                </dd>
            </dl>
              <dl class="form-group">
                <dt>头&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;像：</dt>
                <dd>
                    <input  name="userImg" type="hidden"  id="userImg" >
                    <span id="userImgDiv" style="display: inline-block;">选择头像</span>
                    <span id="tupian" style="display: inline-block;"></span>
                    <span class="Validform_checktip">上传头像</span>
                </dd>
            </dl>
            <dl class="form-group">
                <dt>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</dt>
                <dd>
                    <input id="password"  name="password" type="password" class="input" placeholder="输入登录密码" >
                    <span class="Validform_checktip">请输入6-20位的登录密码</span>
                </dd>
            </dl>
            <dl class="form-group">
                <dt>确认密码：</dt>
                <dd>
                    <input id="txtPassword1" name="yesPassword" type="password" class="input" placeholder="请再次输入密码" >
                    <span class="Validform_checktip">请再次输入登录密码</span>
                </dd>
            </dl>

            <!--开放注册及手机注册-->
            <dl class="form-group">
                <dt>手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机：</dt>
                <dd>
                    <input id="txtMobile" id="phone" name="phone" type="text" class="input" placeholder="输入手机号码" >
                    <span class="Validform_checktip">请输入手机号码</span>
                </dd>
            </dl>
            <!--/开放注册及手机注册-->

            <!--开放注册及邮箱邀请注册-->
            <dl class="form-group">
                <dt>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</dt>
                <dd>
                    <input id="txtEmail" id="email" name="email" type="text" class="input" placeholder="输入邮箱账号" >
                    <span class="Validform_checktip">请输入电子邮箱账号</span>
                </dd>
            </dl>
            <!--/开放注册及邮箱邀请注册-->

            <!--开放注册-->
            <dl class="form-group">
                <dt>验 证 码：</dt>
                <dd>
                    <input id="txtCode" name="code" type="text" class="input code" placeholder="输入验证码" >
                    <a class="send" href="javascript:;">
                        <img src="${pathUrl }/common/public/code" width="80" height="22">
                    </a>
                    <span class="Validform_checktip"></span></dd>
            </dl>
            <!--/开放注册-->




            <dl class="form-group">
                <dd>

                    <input id="btnSubmit"  type="button" value="立即注册" class="submit" >

                </dd>
            </dl>
        </div>
    </form>
</div>


<div class="section qitian-main">
    <img src="${pathUrl }/public/images/qitian.png">
</div>

<div class="footer-copyright">
    <p>软信商城©2013-2017 软信大学版权所有 京ICP备17017089号 京公网安备11000002000006号</p>
</div>
</body>
</html>